<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div id="app">
    <a v-bind:[attributename]="url"> 百度一下 </a>
    <input v-on:[eventname]="doSomething">

    <!--  触发编译警告  -->
    <!--    <a v-bind:['foo' + bar]="value">...</a>-->
</div>

<script src="../js/vue.js"></script>
<script>
    var vm = new Vue({
        el: '#app',
        data: {
            attributename: "href", //这里一定不能用驼峰，否则不能生效
            url: 'https://www.baidu.com',
            eventname: 'focus'
        },
        methods: {
            doSomething() {
                console.log("我获取焦点了！")
            }
        }
    })
</script>
</body>
</html>